//
// Created by 123 on 2024/12/31.
//
/**
* 全局函数做友元
*/

#include "iostream"
using namespace std;

class House{
    //全局函数做友元,gooGay这个方法是House的好朋友,可以访问类中的私有内容
    friend void goodGay(House* house);
private:
    string bedroom;
public:
    string sitroom;
    House(){
        this->bedroom = "bedroom";
        this->sitroom = "sitroom";
    }
};

void goodGay(House* house){
    cout << "gay vist sitroom==" << house->sitroom << endl;
    cout << "gay vist bedroom==" << house->bedroom << endl;
}
void guest(House* house){
    cout << "guest vist sitroom==" << house->sitroom<< endl;
//    cout << "guest vist sitroom==" << house->bedroom<< endl;
}

void test(){
    House house;
    goodGay(&house);
    guest(&house);
}

int main(){
    test();
    return 0;
}